how to print longest word in the string